import logo from './logo.svg';
import './App.css';

import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import Doc from './components/Doc'; 
import Doc2 from './components/Doc2'; 
import Home from './components/Home'; 
import About from './components/About'; 

function App() {
  return (
    <Router>
      <div>
        {/* 主页面的导航链接 */}
        {window.location.pathname !== '/doc' && window.location.pathname !== '/doc2' &&(
          <nav>
            <ul>
              <li>
                <Link to="/">首页</Link>
              </li>
              <li>
                <Link to="/about">关于</Link>
              </li>
            </ul>
          </nav>
        )}
        
        {/* 路由配置 */}
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/doc" element={<Doc />} />
          <Route path="/doc2" element={<Doc2 />} />
          <Route path="/about" element={<About />} />
        </Routes>
      </div>
    </Router>
  );
}

export default App;
